﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Directory.Web
{
	public partial class Controls_SearchBar : System.Web.UI.UserControl
	{
		protected string categoryIdKey = "categoryId";
		protected string keywordsKey = "key";
		protected string searchtypeKey = "searchtype";
		protected void Page_Load(object sender, EventArgs e)
		{
			if (!IsPostBack)
			{
				ddlSearchType.Items.Clear();
				ddlSearchType.Items.Add(Resources.Resource.Item);
				ddlSearchType.Items.Add(Resources.Resource.Category);
				ddlSearchType.Items.Add("全部");
				ddlSearchType.SelectedIndex = 0;
			}
		}

		protected void btnSearch_Click(object sender, EventArgs e)
		{
			Server.Transfer("Search.aspx?" + categoryIdKey + "=-999&" + keywordsKey + "=" + Server.UrlEncode(tbKeywords.Text) + "&" + searchtypeKey + "=" + ddlSearchType.SelectedIndex);
		}
	}
}
